package com.ke.xjt;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class XJTMapper extends Mapper<LongWritable, Text, Text, IntWritable> {
    private final static IntWritable one = new IntWritable(1);
    private Text word = new Text();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        System.out.println("key - - -" + key);
        System.out.println("value - - -" + value);
        System.out.println("context - - -" + context);

        String[] split = value.toString().split("-");

        for (String s : split) {
            word.set(s);
            context.write(word, one);
        }
    }
}
